package body Matrix_Pkg is
   
   function "+"(M1 : Matrix; M2 : Matrix) return Matrix is
      R : Matrix := M1;
   begin
      for I in M2'range(1) loop
         for J in M2'range(2) loop
            R(I,J):=R(I,J)+M2(I,J);
         end loop;
      end loop;
      return R;
   end "+";
   
   function "*"(S : Integer; M: Matrix) return Matrix is
      R: Matrix:=M;   
   begin
      for I in M'range(1) loop
         for J in M'range(2) loop
            R(I,J):=S*R(I,J);
         end loop;
      end loop;
      return R;
   end "*";
   
   function "*"(M1: Matrix; M2: Matrix) return Matrix is
      M : Matrix := M1;
   begin 
      for I in M1'range(1) loop
         for J in M2'range(2) loop
            for L in M1'range(2) loop
               M(I,J):=M1(I,L)*M2(L,J);
            end loop;
         end loop;
      end loop;
      return M;

   end "*";
end Matrix_Pkg;

